/**
 * Created by zzy on 2017/10/26.
 */
/**
 * Created by zzy on 2017/9/26.
 */
import React, {Component} from 'react';
import {
    Text,
    View,
    TouchableOpacity,
    Image,
    StyleSheet,
    PixelRatio,
    FlatList,
    Dimensions
} from 'react-native';
let {width,height} = Dimensions.get('window');

export default class MyTiketUsedCell extends Component{
    render(){
        let {callback}=this.props;
        let tiket=this.props.data;
        return <TouchableOpacity
            style={{backgroundColor: 'white',justifyContent:'center',alignItems:'center'}}
            activeOpacity={1}
            onPress={callback}>
            <Image style={ticketCell.info} source={require('../../luoasserts/tiket/tiket_bg_gray.png')}>
                <View style={ticketCell.info_icon}>
                    <View style={ticketCell.border}>
                        <Text style={ticketCell.self}>自营</Text>
                    </View>
                    <Image style={ticketCell.icon}
                           source={require('../../luoasserts/tiket/tiket_water_icon_gray.png')}></Image>
                </View>
                <View style={ticketCell.info_name}>
                    <Text style={ticketCell.name}>{tiket.productName}</Text>
                    <Text style={ticketCell.scale}>{tiket.brandName}</Text>
                </View>
                <View style={ticketCell.info_msg}>
                    <Text style={ticketCell.use}>有效期:{tiket.restDay}</Text>
                    <Text style={ticketCell.shuipiao}>{tiket.count}张</Text>
                    <Text style={ticketCell.use}>全市通用</Text>

                </View>
            </Image>
        </TouchableOpacity>
    }
}
const ticketCell = StyleSheet.create({
    container: {
        backgroundColor: 'white',
        marginTop:10
    },
    info: {
        flexDirection: 'row',
        justifyContent: 'center',
        alignItems: 'center',
        padding: 10,
        margin: 10,
        width:width-30,
        height:150,
        resizeMode:'contain'
    },
    info_icon: {
        marginLeft: 10,
        alignItems:'center'
    },
    info_name: {
        flex: 1,
        alignItems: 'center'
    },
    info_msg: {
        marginRight: 10,
        alignItems:'center',
        justifyContent:'space-between',
    },
    border: {
        borderWidth: 1 / PixelRatio.get(),
        borderColor: 'white',
        width:30
    },
    self: {
        fontSize: 10,
        color: 'white',
        textAlign: 'center',
    },
    shuipiao: {
        color: 'white',
        fontSize: 20,
        marginTop:20,
        marginBottom:20
    },
    icon: {
        width: 65,
        height: 65,
        resizeMode: 'contain',
        marginTop: 5
    },
    name: {
        color: 'white',
        fontSize: 20
    },
    scale: {
        color: 'white',
        fontSize: 15,
        marginTop: 7
    },
    use: {
        color: 'white',
        fontSize: 13,
    },
    cutLine: {
        backgroundColor: 'gray',
        height: 1 / PixelRatio.get()
    },
    price_info:{
        flexDirection:'row',
        padding:10
    },
    price:{
        color:'red'
    },
    voucher_border:{
        borderWidth: 1 / PixelRatio.get(),
        marginLeft:10,
        justifyContent:'center',
    },
    voucher:{
        color:'gray',
    },
    cart:{
        flex:1,
        flexDirection:'row',
        justifyContent:'flex-end'
    }
});